//iterator
let str:string='hello';
let iterator: IterableIterator<string>=str[Symbol.iterator]();
for(let i=0;i<=str.length;i++){
    console.log(iterator.next());
}

//generator
function* createGenerator(){
    console.log('Start');
    yield 'Hello';
    console.log('Pause');
    yield 'World';
    console.log('Finish');
}
let generator=createGenerator();
let value;
do{
    value=generator.next();
    console.log(value);
}while(!value.done);
